package com.ruoyi.management.carservicestatics.controller;

import java.util.List;

import com.ruoyi.management.carservicestatics.ro.*;
import com.ruoyi.management.carservicestatics.vo.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.management.carservicestatics.service.ITCarServiceStaticsService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

import javax.validation.Valid;

/**
 * carservicestaticsController
 * 
 * @author xly
 * @date 2021-12-08
 */
@Api(tags = "巡游车/驾驶员运营统计")
@RestController
@RequestMapping("/carservicestatics/carservicestatics")
public class TCarServiceStaticsController extends BaseController
{
    @Autowired
    private ITCarServiceStaticsService tCarServiceStaticsService;

    /**
     * 查询carservicestatics列表
     */
    @GetMapping("/list")
    @ApiOperation("查询巡游车运营列表")
    public TableDataInfo<List<GetCarServiceStaticsMonthListVo>> list(@Valid GetCarServiceStaticsListParam param)
    {
        startPage();
        List<GetCarServiceStaticsMonthListVo> list = tCarServiceStaticsService.selectStaticsList(param);
        return getDataTable(list);
    }

    /**
     * 导出carservicestatics列表
     */
    @GetMapping("/export")
    @ApiOperation("导出巡游车运营统计列表")
    public AjaxResult export(@Valid GetCarServiceStaticsListParam param)
    {
        List<GetCarServiceStaticsListVo> list = tCarServiceStaticsService.export(param);
        ExcelUtil<GetCarServiceStaticsListVo> util = new ExcelUtil<GetCarServiceStaticsListVo>(GetCarServiceStaticsListVo.class);
        return util.exportExcel(list, "巡游车运营统计");
    }

    @GetMapping("/get-employee-statics-details")
    @ApiOperation("查询巡游车运营统计列表详情")
    public TableDataInfo<List<GetCarServiceStaticsDetailsVo>> getEmployeeStaticsDetails(@Valid GetCarServiceStaticsDetailsParam param)
    {
        startPage();
        return getDataTable(tCarServiceStaticsService.getEmployeeStaticsDetails(param));
    }

    @GetMapping("/list-dirver")
    @ApiOperation("查询驾驶员运营统计列表")
    public TableDataInfo<List<GetCarServiceStaticsDriverVo>> listDirver(@Valid GetCarServiceStaticsListDriverParam param)
    {
        startPage();
        List<GetCarServiceStaticsDriverVo> list = tCarServiceStaticsService.listDirver(param);
        return getDataTable(list);
    }

    @GetMapping("/list-dirver-details")
    @ApiOperation("查询驾驶员运营统计列表详情")
    public TableDataInfo<List<GetCarServiceStaticsDriverDetailsVo>> listDirverDetails(@Valid GetCarServiceStaticsListDriverDetailsParam param)
    {
        startPage();
        List<GetCarServiceStaticsDriverDetailsVo> list = tCarServiceStaticsService.listDirverDetails(param);
        return getDataTable(list);
    }

    @GetMapping("/list-dirver-details-day")
    @ApiOperation("统计某个驾驶员某个月每天驾驶的车辆的运营次数")
    public TableDataInfo<List<GetCarServiceStaticsDriverDetailsDayVo>> listDirverDetailsDay(@Valid GetCarServiceStaticsListDriverDetailsDayParam param)
    {
        startPage();
        List<GetCarServiceStaticsDriverDetailsDayVo> list = tCarServiceStaticsService.listDirverDetailsDay(param);
        return getDataTable(list);
    }

    @GetMapping("/export-driver")
    @ApiOperation("导出驾驶员运营统计列表")
    public AjaxResult exportDriver(@Valid GetCarServiceStaticsListDriverParam param)
    {
        List<GetCarServiceStaticsDriverExportVo> list = tCarServiceStaticsService.exportDriver(param);
        ExcelUtil<GetCarServiceStaticsDriverExportVo> util = new ExcelUtil<GetCarServiceStaticsDriverExportVo>(GetCarServiceStaticsDriverExportVo.class);
        return util.exportExcel(list, "驾驶员运营统计");
    }

    @GetMapping("/list-details-day")
    @ApiOperation("统计某辆车某个月每天的驾驶员的运营次数")
    public TableDataInfo<List<GetCarServiceStaticsDetailsDayVo>> listDetailsDay(@Valid GetCarServiceStaticsListDetailsDayParam param)
    {
        startPage();
        List<GetCarServiceStaticsDetailsDayVo> list = tCarServiceStaticsService.listDetailsDay(param);
        return getDataTable(list);
    }
}
